<!DOCTYPE html>
<html lang="en">
    <head>
        <title>CSDN主页</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="css/mainpage.css">
        <link rel="stylesheet" href="//cdn.bootcss.com/semantic-ui/2.2.7/semantic.min.css">
        <script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
        <script src="/js/loadmore.js?a=15843523"></script>
    </head>
    <body>
        <div class="box--total">
            <div class="header">
                <div class="header-logo center">
                    <a href="/mainpage">
                        <img src="img/local/logo.jpg" alt="">
                    </a>
                </div>
                <div class="header-item">
                    <a href="" class="link-header-item center">新闻</a>
                </div>
                <div class="header-item">
                    <a href="/posts" class="link-header-item center">文章</a>
                </div>
            </div>
            <div class="background center">
                <img src="img/local/csdn.jpg" alt="">
            </div>
            <div class="body">
                <div class="body-introbox center">
                    <div class="body-intro">
                        <div class="body-intro-text center">
                            <strong>It just works!</strong>
                        </div>
                        <div class="body-intro-button center">
                            <a href="" class="link-intro center">
                                <span>了解更多</span>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="body-newsbox center">
                    <div class="body-news">
                        <div class="body-news-icon center">
                            <img src="img/local/news.png" alt="" class="img-newsicon center">
                        </div>
                        <%  var newsPost = {
                                _id　: 1,
                                author : "VAN",
                                title　: "暂无新公告",
                                pv : 0,
                                content : "<h1>什么都还没写</h1>",
                                commentsCount : 0,
                                created_at :　"宇宙大爆炸之前"　
                            };
                            posts.forEach(function (post) {
                                if(post.author.name == "官方账号") {
                                    newsPost = post;
                                    return false;
                                }
                            })   %>
                        <div class="body-news-text center">
                            <strong class="text-newstext-major">社团新闻</strong>
                            <span class="text-newstext-minor">社团的大事小事都能在这里发现哦</span>
                            <span class="text-newstext-hidden">总想搞个大新闻= =</span>
                        </div>
                        <div class="body-news-box">
                            <div class="body-news-header">
                                <a class="text-newsheader-title" href="/posts/<%= newsPost._id %>"><%= newsPost.title%></a>
                                <span class="text-newsheader-detail">阅读(<%= newsPost.pv%>)</span>
                                <span class="text-newsheader-detail">评论(<%= newsPost.commentsCount%>)</span>
                                <span class="text-newsheader-detail"><%= newsPost.created_at%></span>
                            </div>
                            <div class="body-news-content">
                                <div class="text-newscontent">
                                    <%- newsPost.content%>
                                </div>
                            </div>
                            <div class="body-news-footer">
                                <a href="/posts/user?author=<%= newsPost.author._id %>" class="link-morenews center">更多新闻</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="body-articlebox">
                    <div class="body-article">
                        <div class="body-article-icon center">
                            <img src="img/local/articles.png" alt="" class="img-articleicon center">
                        </div>
                        <div class="body-article-text center">
                            <strong class="text-articletext-major">文章</strong>
                            <span class="text-articletext-minor">瞎扯淡的地方，水水更健康</span>
                            <span class="text-articletext-hidden">前方装逼高能 ！</span>
                        </div>
                        <% posts.forEach(function (post) {  %>
                            <div class="body-article-item">
                                <div class="article-item-author">
                                    <div class="article-item-author-avatar center">
                                        <a href="/posts/user?author=<%= post.author._id %>">
                                            <img src="/img/users_avatar/<%= post.author.avatar%>" alt="" class="img-author-avatar center">
                                        </a>
                                    </div>
                                    <div class="article-item-author-name">
                                        <span class="text-authorname"><%= post.author.name%></span>
                                    </div>
                                </div>
                                <div class="article-item-content">
                                    <div class="article-item-content-title">
                                        <a class="text-article-title" href="/posts/<%= post._id%>"><%= post.title%></a>
                                    </div>
                                    <div class="article-item-content-text">
                                        <div class="text-article-content">
                                            <%- post.content%>
                                        </div>
                                    </div>
                                    <div class="article-item-content-footer">
                                        <span class="text-article-info"><%= post.created_at%></span>
                                        <span class="text-article-info">阅读(<%= post.pv%>)</span>
                                        <span class="text-article-info">阅读(<%= post.commentsCount%>)</span>
                                    </div>
                                </div>
                            </div>
                        <%  })   %>
                        <div class="body-article-footer">
                            <a href="/posts" class="link-morearticles center">更多文章</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="footer">
                <div class="footer-links">
                    <div class="footer-links-text center">
                        <span>友情链接</span>
                    </div>
                    <div class="footer-links-item center">
                        <a href="http://www.ysu.edu.cn/">燕山大学</a>
                    </div>
                    <div class="footer-links-item center">
                        <a href="http://www.ysu.edu.cn/">燕山大学</a>
                    </div>
                </div>
            </div>
        </div>

        <%- include('components/back-to-top') %>
        
    </body>
</html>